package mine.adapter;

import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;

import com.orm.SugarRecord;
import com.whu.administrator.ws.MyApplication;
import com.whu.administrator.ws.R;

import java.util.ArrayList;
import java.util.List;

import model.BeiWang;
import model.NoteBook;

/**
 * Created by Administrator on 2016/3/19.
 */
public class BeiWangAdapter extends BaseAdapter {
    List<BeiWang> beiWangs = new ArrayList<BeiWang>();

    public void setBeiWangs(List<BeiWang> beiWangs) {
        this.beiWangs = beiWangs;
    }


    @Override
    public int getCount() {
        return beiWangs.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if (convertView == null) {
            viewHolder = new ViewHolder();
            convertView = View.inflate(MyApplication.share(), R.layout.item_beiwang, null);
            viewHolder.tv_time = (TextView) convertView.findViewById(R.id.id_tv_time);
            viewHolder.tv_content = (TextView) convertView.findViewById(R.id.id_tv_content);
            convertView.setTag(viewHolder);

        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        BeiWang beiWang = beiWangs.get(position);
        viewHolder.tv_time.setText(beiWang.getTime());
        viewHolder.tv_content.setText(beiWang.getContent());
        return convertView;
    }


    public static class ViewHolder {
        public TextView tv_time;
        public TextView tv_content;
    }
}
